package io.zhifei.modules.sys.dataStatistical.util;
/*
 * @Author wangyuanyue
 * @Date 2020/12/24 13:57
 * @Content 用户判断
 */

import io.zhifei.modules.sys.dataStatistical.entity.FollowerChooseInfo;
import io.zhifei.modules.sys.system.entity.SysUserEntity;

import java.util.List;

public class UserFunction {

    /**
     * 判断业务员
     * @param sysUserEntity
     * @return
     */
    public static FollowerChooseInfo dataStatisticalByFollower(SysUserEntity sysUserEntity) {
        //业务员+其他
        int myself = 0;
        //主管+校区负责人
        int campus = 0;
        //校长
        int allCampus = 0;
        //管理员
        int management = 0;
        List<Long> roleIdList = sysUserEntity.getRoleIdList();
        if(roleIdList != null){
            if (roleIdList.contains(1L) || roleIdList.contains(2L)){
                management++;
            }else if (roleIdList.contains(3L)){
                allCampus++;
            }else if (roleIdList.contains(4L) ||
                    roleIdList.contains(5L) ||
                    roleIdList.contains(6L)||
                    roleIdList.contains(7L) ||
                    roleIdList.contains(8L) ||
                    roleIdList.contains(9L)||
                    roleIdList.contains(10L) ||
                    roleIdList.contains(11L)
            ){
                campus++;
            } else {
                myself++;
            }
            }
            //for(int i = 0 ; i < sysUserEntity.getRoleIdList().size() ; i++){
            //    // TODO: 2021/6/9 修改权限，除了业务主管之外的，其他的都是业务员
            //    if(sysUserEntity.getRoleIdList().get(i) == 7){
            //        campus++;
            //    }else if(sysUserEntity.getRoleIdList().get(i) == 6
            //            || sysUserEntity.getRoleIdList().get(i) == 5
            //            || sysUserEntity.getRoleIdList().get(i) == 4
            //            || sysUserEntity.getRoleIdList().get(i) == 3){
            //        allCampus++;
            //    }else if (sysUserEntity.getRoleIdList().get(i) == 1
            //            ||sysUserEntity.getRoleIdList().get(i) == 2){
            //        //管理员
            //        allCampus++;
            //    }else {
            //        myself++;
            //    }
            //
            //    //if(sysUserEntity.getRoleIdList().get(i) == 8){
            //    //    myself++;
            //    //}
            //    //if(sysUserEntity.getRoleIdList().get(i) == 7
            //    //        || sysUserEntity.getRoleIdList().get(i) == 6
            //    //        || sysUserEntity.getRoleIdList().get(i) == 5
            //    //        || sysUserEntity.getRoleIdList().get(i) == 4){
            //    //    campus++;
            //    //}
            //    //if(sysUserEntity.getRoleIdList().get(i) == 3){
            //    //    allCampus++;
            //    //}
            //}
        //}
        FollowerChooseInfo followerChooseInfo = new FollowerChooseInfo();
        followerChooseInfo.setMyself(myself);
        followerChooseInfo.setCampus(campus);
        followerChooseInfo.setAllCampus(allCampus);
        followerChooseInfo.setManagement(management);
        return followerChooseInfo;
    }
}
